<?php
/*
Description: This file is used to create access group, which will contain list of modules accessble for 
the users who belongs to this group.
*/
#########IncludeFiles####################################################################################
include_once '../inc/config.php';
include_once("../inc/bootstrape.php");
require_once _SITE_PATH_.'classes/CommonUtility/CommonUtility.php';

//    CHANGE PASSWORD    CODE    //           
if( $_POST['submit']=='Submit')
{    
    $parms['group_name'] = $_POST['group_name'];
    $parms['module_id'] = @implode(',',$_POST['modules']);
    $moduleStr = '';
    foreach( $_POST['modules'] as $val ){
        $moduleStr[] = $val . '::'. @implode('-',$_POST['op_'.$val]);;        
    }
    $parms['module_id'] = @implode(',',$moduleStr);
    $parms['added'] = date('Y-m-d');
    
    if( CommonUtility::insertData($parms, 'access_group')) {        
        header("Location: access_group_mng.php?msg=1061");            
        exit;
    }
    $err = 1062;    
}

//    END CHANGE PASSWORD CODE    //
$errMsg = $err;
$_tplName = 'access-module/access_group_add.tpl';
$_title = 'Add Access Group';
require_once _ADMIN_TPL_MAIN_;
?>